<template>
	<view class="logistics-info" @click="$emit('copy', row)">
		<!-- 收货人 -->
		<view class="info-row receiver">
			<text class="name">{{ row.receiverName }}</text>
			<text class="phone">{{ row.receiverPhone || '—' }}</text>
			<uni-tag
				v-if="row.orderCount > 1"
				type="warning"
				size="small"
				custom-style="font-size: 20rpx; padding: 2rpx 8rpx; height: 28rpx; margin-left: 12rpx;"
				@click.stop="$emit('payHistory', row)"
			>
				第{{ row.orderCount }}次购买
			</uni-tag>
		</view>

		<!-- 地址 -->
		<view class="info-row address">
			<text>{{ row.receiverAddress || '地址未填写' }}</text>
		</view>
	</view>
</template>

<script setup lang="ts">
defineProps<{ row: any }>();
defineEmits(['copy', 'payHistory']);
</script>

<style scoped>
.logistics-info {
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
	line-height: 1.5;
}

.info-row {
	display: flex;
	align-items: center;
}

.receiver {
	font-size: 30rpx;
	font-weight: 600;
	color: #1a1a1a;
}

.name {
	margin-right: 16rpx;
}

.phone {
	color: #555;
	font-size: 28rpx;
}

.address {
	font-size: 26rpx;
	color: #666;
	margin-top: 6rpx;
}

/* 地址为空时的提示 */
.address text:empty::before {
	content: '地址未填写';
	color: #ccc;
}
</style>
